% usage
% c:     restore in.pgm out.pgm
% mex:   out = mexbp(in); if have mask,use out = mexbp(in,mask);
clear;
% im = imread('input.png');
% im = double(im);
% out = mexbp1(im);
% imshow(im,[]);
% figure,imshow(out);

im = imread('house-input.png');
im = double(im);
mask = imread('house-mask.png');
mask = double(mask);
mask = mask/255;
mask = round(mask);
out = mexbp(im,mask);
imshow(im,[]);
figure,imshow(out,[]);